<template>
  <div class="gallery" @click="handleGallery">
    <div class="wrapper">
      <swiper :options="swiperOption">
        <!-- slides -->
        <swiper-slide v-for="(item,index) in imgList" :key="index">
          <img class="swipper-img" :src="item" alt="">
        </swiper-slide>
        <!-- Optional controls -->
        <div class="swiper-pagination"  slot="pagination"></div>
      </swiper>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Gallery',
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        paginationType: 'fraction',
        loop: true,
        observeParents: true,
        observe: true
      }
    }
  },
  props: ['imgList'],
  methods: {
    handleGallery () {
      this.$emit('close')
    }
  }
}
</script>

<style lang="stylus" scoped>
  .gallery >>> .swiper-container
    overflow: inherit
  .gallery
    display: flex
    flex-direction column
    justify-content center
    position: absolute
    top: 0
    right: 0
    left: 0
    bottom: 0
    background-color: #000;
    z-index: 999
    .wrapper
      overflow: inherit
      width: 100%
      height: 0
      padding-bottom: 66%
      background-color: #ccc
      .swipper-img
        width: 100%
      .swiper-pagination
        color: #fff
        bottom: -1rem
</style>
